﻿Public Class Nlocalidad
    Private objlocalidad As Datos.Dlocalidad

    Public Sub New()
        objlocalidad = New Datos.DLocalidad
    End Sub


    Public Function guardarlocalidad(ByVal item As Entidades.Elocalidad) As Boolean
        Dim oDatos As New Datos.DLocalidad
        Dim oLocalidades As New List(Of Entidades.ELocalidad)
        Dim band As Boolean
        Try
            band = oDatos.guardar(item)
        Catch ex As Exception
            Throw New ArgumentException(ex.Message)
        Finally
            oDatos = Nothing
        End Try
        Return band
    End Function
    
    Public Function modificarlocalidad(ByVal localidad As Entidades.Elocalidad) As Boolean
        Dim oDatos As New Datos.DLocalidad
        Dim oLocalidades As New List(Of Entidades.Elocalidad)
        Dim band As Boolean
        Try
            band = oDatos.modificar(localidad)
        Catch ex As Exception
            Throw New ArgumentException(ex.Message)
        Finally
            oDatos = Nothing
        End Try
        Return band
    End Function

    Public Function buscarlocalidad(ByVal texto As String) As DataTable

        Dim oDatos As New Datos.DLocalidad
        Try
            Return oDatos.buscar(texto)
        Catch ex As Exception
            Throw New ArgumentException(ex.Message)
        Finally
            oDatos = Nothing
        End Try
    End Function

    Public Function buscardepartamento(ByVal texto As String) As DataTable
        Dim oDatos As New Datos.DDepartamento
        Try
            Return oDatos.buscardepartamento(texto)
        Catch ex As Exception
            Throw New ArgumentException(ex.Message)
        Finally
            oDatos = Nothing
        End Try
    End Function

End Class
